import 'node-assist'
import CommonUtil from 'js-common-modules/lib/utils/CommonUtil'
import EthWalletHelper from 'js-common-modules/lib/helpers/ether/EthWalletHelper'

global['logger'] = console

const config = {
  version: 'mainnet',
  mnemonic: 'my name is joy, human effort is the decisive factor.',
  password: '****',
  index: 0 // m/44'/60'/0'/0/{index}
}


CommonUtil.startAsyncMethod(async () => {
  const ethWalletHelper = new EthWalletHelper()
  const pair = ethWalletHelper.getMasterPairByMnemonic(config['mnemonic'], config['password'], config['version'])
  const hdPriv = ethWalletHelper.getHdPrivateKeyByXpriv(pair['xpriv'], config['version'])
  logger.error(ethWalletHelper.deriveAllByHdPrivKeyIndex(hdPriv, config['index']))
})

